package com.lollipop.programming.designpattern.singleton;

/**
 * @Author Lollipop
 * @Date 2025/4/7 16:09
 * @Description 双重检查单例模式
 */
public class SingletonDcl {
    private static volatile SingletonDcl INSTANCE;

    private SingletonDcl() {
    }

    private static SingletonDcl getInstance() {
        if (INSTANCE == null) {
            synchronized (SingletonDcl.class) {
                if (INSTANCE == null) {
                    INSTANCE = new SingletonDcl();
                }
                return INSTANCE;
            }
        }
        return INSTANCE;
    }
}
